package com.example.springboot.flowable;

/**
 * @author yuwl
 * @description
 * @since 2024-08-08 18:29
 */

import org.flowable.engine.delegate.DelegateExecution;
import org.flowable.engine.delegate.JavaDelegate;
import org.springframework.stereotype.Component;

@Component("dynamicTaskAssignment")
public class DynamicTaskAssignmentDelegate implements JavaDelegate {

    @Override
    public void execute(DelegateExecution execution) {
        String assignee = determineAssigneeBasedOnBusinessLogic();
        execution.setVariable("assignee", assignee);
    }

    private String determineAssigneeBasedOnBusinessLogic() {
        // 这里可以放你的业务逻辑来确定任务的受理人
        return "johnDoe";  // 示例：返回一个用户ID
    }
}

